/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ejb;

import entidades.Utilizador;
import javax.ejb.EJBException;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author Joel
 */
@Stateless
public class UtilizadorBean {

   @PersistenceContext
    private EntityManager em;

    public boolean existeUsername(String username) {
        try {
            return em.find(Utilizador.class, username) != null;
        } catch (Exception e) {
            throw new EJBException(e.getMessage());
        }
    }  

}
